#include "stdio.h"
#include "stdlib.h"
#include "syscall.h"


int main(int argc, char **argv)
{
	printf("Ping test.\n");
	int fd = -1;
	int i;
	char buf[256];

	while(fd == -1)
	{
		fd = accept(42);
	}
	
	printf("Connection accepted\n");

	for(i =0; i < 50; i++)
	{
		sprintf(buf, "Ping %d\n", i);
		printf(buf);

		if(write(fd, buf, strlen(buf)) != strlen(buf))
		{
			printf("Ping test got write error\n");
			close(fd);
			return 0;
		}

	}

	printf("Ping closing connection\n");
	close(fd);

	printf("Ping test done.\n");

	return 0;
}
